package com.study.javaBasic.sourcecode;

/**
 * HashMap中散列算法的测试
 */
public class HashTest {
    public static void main(String[] args) {
        System.out.println("------------直接求模的hash值----------------");
        /**
         * 直接求模的hash值
         */
        for (int i = 0; i < 10; i++) {
            int code = 65536 * i + 13569;
            System.out.println(code % 16);
        }
        System.out.println("------------进行散列的hash----------------");
        /**
         * 进行散列的hash
         */
        for (int i = 0; i < 10; i++) {
            int code = 65536 * i + 13569;
            System.out.println((code ^ (code >>> 16))% 16);
        }
    }
}
